using UnityEngine;
using System.Collections;

public class AtlasManager : MonoBehaviour 
{
    public static Texture2D globalTexture;
    public static Rect[] rects;
    public static Material globalMaterial; 
    
    private Texture2D[] textures;
    
    void Awake ()
    {
        int numImages = 100;

        textures = new Texture2D[numImages];

        this.textures[0] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_Menu");
        this.textures[1] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_Instrucoes");
        this.textures[2] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_Creditos");
        this.textures[3] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_Explicativa");
        this.textures[4] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_Explicativa2");
        this.textures[5] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_Explicativa3");
        this.textures[6] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_Pass_Tempo_1");
        this.textures[7] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_Pass_Tempo_2");
        this.textures[8] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_Pass_Tempo_3");
        this.textures[9] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_Sinopse");
        this.textures[10] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_Escola");
        this.textures[11] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_Engenhao");
        this.textures[12] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_RichardJoga");
        this.textures[13] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_E_Sua_Vez");
        this.textures[14] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_CaioJoga");
        this.textures[15] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_Vitoria");
        this.textures[16] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_Derrota");
        this.textures[17] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_CNTE");
        this.textures[18] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_EOCS");
        this.textures[19] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Iniciar01");
        this.textures[20] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Iniciar02");
        this.textures[21] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Iniciar03");
        this.textures[22] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Instrucoes01");
        this.textures[23] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Instrucoes02");
        this.textures[24] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Instrucoes03");
        this.textures[25] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Creditos01");
        this.textures[26] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Creditos02");
        this.textures[27] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Creditos03");
        this.textures[28] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Avancar01");
        this.textures[29] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Avancar02");
        this.textures[30] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Avancar03");
        this.textures[31] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Voltar01");
        this.textures[32] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Voltar02");
        this.textures[33] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Voltar03");
        this.textures[34] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Recomecar01");
        this.textures[35] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Recomecar02");
        this.textures[36] = (Texture2D)Resources.Load("Textures/" + "OI_Botao_Recomecar03");
        this.textures[37] = (Texture2D)Resources.Load("Textures/" + "OI_Tela_PraiaVermelha");
        this.textures[38] = (Texture2D)Resources.Load("Textures/" + "OI_Tiro_Mira");
        this.textures[39] = (Texture2D)Resources.Load("Textures/" + "OI_Tiro_Arma");
        this.textures[40] = (Texture2D)Resources.Load("Textures/" + "OI_Tiro_Arma2");
        this.textures[41] = (Texture2D)Resources.Load("Textures/" + "OI_Escola_Fala_1");
        this.textures[42] = (Texture2D)Resources.Load("Textures/" + "OI_Escola_Fala_2");
        this.textures[43] = (Texture2D)Resources.Load("Textures/" + "OI_Escola_Fala_3");
        this.textures[44] = (Texture2D)Resources.Load("Textures/" + "OI_Escola_Fala_4");
        this.textures[45] = (Texture2D)Resources.Load("Textures/" + "OI_Escola_Fala_5");
        this.textures[46] = (Texture2D)Resources.Load("Textures/" + "OI_Praia_Fala_1");
        this.textures[47] = (Texture2D)Resources.Load("Textures/" + "OI_Praia_Fala_2");
        this.textures[48] = (Texture2D)Resources.Load("Textures/Personagens/Caio" + "Caio0024");
        this.textures[49] = (Texture2D)Resources.Load("Textures/Personagens/Richard" + "Richard0024");

        globalTexture = AtlasTexture.Create(this.textures, out rects);
        globalMaterial =  new Material((Shader)Resources.Load("Shader/Basic2D"));
        globalMaterial.mainTexture = globalTexture;
	}
}